package com.weiyuwqj.admin.controller.admin.sys;

import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.service.SysConfigParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by huzj on 2017/3/27.
 */
@Controller
@RequestMapping("/sys/configParam")
public class SysConfigParamController {

    @Autowired
    SysConfigParameterService configParameterService;

    /**
     * 查询系统设置列表
     * @param p
     * @return
     */
    @ResponseBody
    @RequestMapping(value ="/getList",method= RequestMethod.POST)
    public Object getList(Paginator p){
        return configParameterService.getList(p);
    }

    /**
     * 根据key查询单条记录
     * @param key
     * @return
     */
    @ResponseBody
    @RequestMapping(value ="/getOne",method= RequestMethod.POST)
    public Object getParamterByKey(String key){
        return configParameterService.getParamterByKey(key);
    }

    /**
     * 根据key修改value
     * @param key
     * @param value
     * @return
     */
    @ResponseBody
    @RequestMapping(value ="/update",method= RequestMethod.POST)
    public Object updateValueByKey(String key,String value){
        return configParameterService.updateValueByKey(key, value);
    }

}
